﻿using Nancy.Hosting.Self;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;

namespace PC.Client
{
    public partial class Service : ServiceBase
    {
        public Service()
        {
            InitializeComponent();
        }

        int port = Convert.ToInt32(ConfigurationManager.AppSettings["port"]);

        protected override void OnStart(string[] args)
        {
            try
            {
                NancyHost nancySelfHost = new NancyHost(new Uri("http://localhost:" + port + "/"));
                nancySelfHost.Start();
            }
            catch (Exception ex)
            {
                LogHelper.Error("NancyHost启动异常 => " + ex.ToString());
            }
        }

        protected override void OnStop()
        {
        }
    }
}
